import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    redirect: { path: '/home' },
    component: () => import(/* webpackChunkName: "index" */ '../pages/index.vue'),
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import(/* webpackChunkName: "home" */ '../pages/home/index.vue')
      },
      {
        path: '/home/newslist',
        name: 'newslist',
        component: () => import(/* webpackChunkName: "home" */'../pages/home/news/newslist.vue')
      },
      {
        path: '/search',
        name: 'search',
        component: () => import(/* webpackChunkName: "search" */ '../pages/search/index.vue')
      },
      {
        path: '/carts',
        name: 'carts',
        component: () => import(/* webpackChunkName: "carts" */ '../pages/carts/index.vue')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import(/* webpackChunkName: "my" */ '../pages/my/index.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
